package com.itheima.util;

import java.sql.*;

public class JdbcDemo01 {
    public static void main(String[] args) {
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        try {
            conn = JdbcUtils.getConnection();
            String sql = "select * from admin";
            stmt = conn.createStatement();
            rs = stmt.executeQuery(sql);
            while (rs.next()) {
                String id = rs.getString("id");
                String userName = rs.getString("username");
                String passWord = rs.getString("password");
                System.out.println(id + "-" + userName + "-" + passWord);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            JdbcUtils.close(conn,stmt,rs);
        }
    }
}
